
<!doctype html>
<html lang="zh" class="no-js">
  <head>
    
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width,initial-scale=1">
      
        <meta name="description" content="国光的黑苹果安装教程：手把手教你配置 OpenCore">
      
      
        <meta name="author" content="国光">
      
      
        <link rel="canonical" href="https://apple.sqlsec.com/6-%E5%AE%9E%E7%94%A8%E5%A7%BF%E5%8A%BF/6-3/">
      
      <link rel="icon" href="https://image.3001.net/images/20200922/16007336487809.jpg">
      <meta name="generator" content="mkdocs-1.4.2, mkdocs-material-8.5.1">
    
    
      
        <title>触控板中断示例 - 国光的黑苹果安装教程：手把手教你配置 OpenCore</title>
      
    
    
      <link rel="stylesheet" href="../../assets/stylesheets/main.2e8b5541.min.css">
      
        
        <link rel="stylesheet" href="../../assets/stylesheets/palette.cbb835fc.min.css">
        
      
      

    
    
    
      
    
    
    <script>__md_scope=new URL("../..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
    
      

    
    
    
  </head>
  
  
    
    
      
    
    
    
    
    <body dir="ltr" data-md-color-scheme="default" data-md-color-primary="indigo" data-md-color-accent="indigo">
  
    
    
      <script>var palette=__md_get("__palette");if(palette&&"object"==typeof palette.color)for(var key of Object.keys(palette.color))document.body.setAttribute("data-md-color-"+key,palette.color[key])</script>
    
    <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
    <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
    <label class="md-overlay" for="__drawer"></label>
    <div data-md-component="skip">
      
        
        <a href="#_1" class="md-skip">
          跳转至
        </a>
      
    </div>
    <div data-md-component="announce">
      
    </div>
    
    
      

  

<header class="md-header md-header--lifted" data-md-component="header">
  <nav class="md-header__inner md-grid" aria-label="页眉">
    <a href="../.." title="国光的黑苹果安装教程：手把手教你配置 OpenCore" class="md-header__button md-logo" aria-label="国光的黑苹果安装教程：手把手教你配置 OpenCore" data-md-component="logo">
      
  
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11Z"/></svg>

    </a>
    <label class="md-header__button md-icon" for="__drawer">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg>
    </label>
    <div class="md-header__title" data-md-component="header-title">
      <div class="md-header__ellipsis">
        <div class="md-header__topic">
          <span class="md-ellipsis">
            国光的黑苹果安装教程：手把手教你配置 OpenCore
          </span>
        </div>
        <div class="md-header__topic" data-md-component="header-topic">
          <span class="md-ellipsis">
            
              触控板中断示例
            
          </span>
        </div>
      </div>
    </div>
    
      <form class="md-header__option" data-md-component="palette">
        
          
          
          <input class="md-option" data-md-color-media="" data-md-color-scheme="default" data-md-color-primary="indigo" data-md-color-accent="indigo"  aria-label="切换深色模式"  type="radio" name="__palette" id="__palette_1">
          
            <label class="md-header__button md-icon" title="切换深色模式" for="__palette_2" hidden>
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m17.75 4.09-2.53 1.94.91 3.06-2.63-1.81-2.63 1.81.91-3.06-2.53-1.94L12.44 4l1.06-3 1.06 3 3.19.09m3.5 6.91-1.64 1.25.59 1.98-1.7-1.17-1.7 1.17.59-1.98L15.75 11l2.06-.05L18.5 9l.69 1.95 2.06.05m-2.28 4.95c.83-.08 1.72 1.1 1.19 1.85-.32.45-.66.87-1.08 1.27C15.17 23 8.84 23 4.94 19.07c-3.91-3.9-3.91-10.24 0-14.14.4-.4.82-.76 1.27-1.08.75-.53 1.93.36 1.85 1.19-.27 2.86.69 5.83 2.89 8.02a9.96 9.96 0 0 0 8.02 2.89m-1.64 2.02a12.08 12.08 0 0 1-7.8-3.47c-2.17-2.19-3.33-5-3.49-7.82-2.81 3.14-2.7 7.96.31 10.98 3.02 3.01 7.84 3.12 10.98.31Z"/></svg>
            </label>
          
        
          
          
          <input class="md-option" data-md-color-media="" data-md-color-scheme="slate" data-md-color-primary="black" data-md-color-accent="blue"  aria-label="切换浅色模式"  type="radio" name="__palette" id="__palette_2">
          
            <label class="md-header__button md-icon" title="切换浅色模式" for="__palette_1" hidden>
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 7a5 5 0 0 1 5 5 5 5 0 0 1-5 5 5 5 0 0 1-5-5 5 5 0 0 1 5-5m0 2a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0-7 2.39 3.42C13.65 5.15 12.84 5 12 5c-.84 0-1.65.15-2.39.42L12 2M3.34 7l4.16-.35A7.2 7.2 0 0 0 5.94 8.5c-.44.74-.69 1.5-.83 2.29L3.34 7m.02 10 1.76-3.77a7.131 7.131 0 0 0 2.38 4.14L3.36 17M20.65 7l-1.77 3.79a7.023 7.023 0 0 0-2.38-4.15l4.15.36m-.01 10-4.14.36c.59-.51 1.12-1.14 1.54-1.86.42-.73.69-1.5.83-2.29L20.64 17M12 22l-2.41-3.44c.74.27 1.55.44 2.41.44.82 0 1.63-.17 2.37-.44L12 22Z"/></svg>
            </label>
          
        
      </form>
    
    
    
      <label class="md-header__button md-icon" for="__search">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
      </label>
      <div class="md-search" data-md-component="search" role="dialog">
  <label class="md-search__overlay" for="__search"></label>
  <div class="md-search__inner" role="search">
    <form class="md-search__form" name="search">
      <input type="text" class="md-search__input" name="query" aria-label="搜索" placeholder="搜索" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
      <label class="md-search__icon md-icon" for="__search">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
      </label>
      <nav class="md-search__options" aria-label="查找">
        
          <a href="javascript:void(0)" class="md-search__icon md-icon" title="分享" aria-label="分享" data-clipboard data-clipboard-text="" data-md-component="search-share" tabindex="-1">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7 0-.24-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.15c-.05.21-.08.43-.08.66 0 1.61 1.31 2.91 2.92 2.91 1.61 0 2.92-1.3 2.92-2.91A2.92 2.92 0 0 0 18 16.08Z"/></svg>
          </a>
        
        <button type="reset" class="md-search__icon md-icon" title="清空当前内容" aria-label="清空当前内容" tabindex="-1">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41Z"/></svg>
        </button>
      </nav>
      
        <div class="md-search__suggest" data-md-component="search-suggest"></div>
      
    </form>
    <div class="md-search__output">
      <div class="md-search__scrollwrap" data-md-scrollfix>
        <div class="md-search-result" data-md-component="search-result">
          <div class="md-search-result__meta">
            正在初始化搜索引擎
          </div>
          <ol class="md-search-result__list"></ol>
        </div>
      </div>
    </div>
  </div>
</div>
    
    
      <div class="md-header__source">
        <a href="https://github.com/sqlsec/Hackintosh" title="前往仓库" class="md-source" data-md-component="source">
  <div class="md-source__icon md-icon">
    
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
  </div>
  <div class="md-source__repository">
    sqlsec/Hackintosh
  </div>
</a>
      </div>
    
  </nav>
  
    
      
<nav class="md-tabs" aria-label="标签" data-md-component="tabs">
  <div class="md-tabs__inner md-grid">
    <ul class="md-tabs__list">
      
        
  
  


  <li class="md-tabs__item">
    <a href="../.." class="md-tabs__link">
      主页
    </a>
  </li>

      
        
  
  


  
  
  
    <li class="md-tabs__item">
      <a href="../../0-%E5%89%8D%E8%A8%80%E4%BB%8B%E7%BB%8D/0-1/" class="md-tabs__link">
        前言介绍
      </a>
    </li>
  

      
        
  
  


  
  
  
    <li class="md-tabs__item">
      <a href="../../1-%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/1-1/" class="md-tabs__link">
        基础知识
      </a>
    </li>
  

      
        
  
  


  
  
  
    <li class="md-tabs__item">
      <a href="../../2-U%E7%9B%98%E5%88%B6%E4%BD%9C/2-1/" class="md-tabs__link">
        U盘制作
      </a>
    </li>
  

      
        
  
  


  
  
  
    <li class="md-tabs__item">
      <a href="../../3-%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C/3-1/" class="md-tabs__link">
        准备工作
      </a>
    </li>
  

      
        
  
  


  
  
  
    <li class="md-tabs__item">
      <a href="../../4-OC%E9%85%8D%E7%BD%AE/4-1/" class="md-tabs__link">
        配置 OC
      </a>
    </li>
  

      
        
  
  


  
  
  
    <li class="md-tabs__item">
      <a href="../../5-%E5%AE%9E%E6%88%98%E6%BC%94%E7%A4%BA/5-1/" class="md-tabs__link">
        实战演示
      </a>
    </li>
  

      
        
  
  
    
  


  
  
  
    <li class="md-tabs__item">
      <a href="../6-1/" class="md-tabs__link md-tabs__link--active">
        实用姿势
      </a>
    </li>
  

      
        
  
  


  
  
  
    <li class="md-tabs__item">
      <a href="../../7-%E5%AE%8C%E7%BE%8E%E9%BB%91%E6%9E%9C/7-1/" class="md-tabs__link">
        完美黑果
      </a>
    </li>
  

      
        
  
  


  
  
  
    <li class="md-tabs__item">
      <a href="../../8-OC%E6%8E%92%E9%94%99/8-1/" class="md-tabs__link">
        OC排错
      </a>
    </li>
  

      
        
  
  


  
  
  
    <li class="md-tabs__item">
      <a href="../../9-%E6%88%90%E6%9E%9C%E5%88%86%E4%BA%AB/9-1/" class="md-tabs__link">
        成果分享
      </a>
    </li>
  

      
        
  
  


  
  
  
    <li class="md-tabs__item">
      <a href="../../10-%E5%B8%B8%E8%A7%81QA/10-1/" class="md-tabs__link">
        常见 QA
      </a>
    </li>
  

      
    </ul>
  </div>
</nav>
    
  
</header>
    
    <div class="md-container" data-md-component="container">
      
      
        
      
      <main class="md-main" data-md-component="main">
        <div class="md-main__inner md-grid">
          
            
              
              <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    

  


<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="导航栏" data-md-level="0">
  <label class="md-nav__title" for="__drawer">
    <a href="../.." title="国光的黑苹果安装教程：手把手教你配置 OpenCore" class="md-nav__button md-logo" aria-label="国光的黑苹果安装教程：手把手教你配置 OpenCore" data-md-component="logo">
      
  
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11Z"/></svg>

    </a>
    国光的黑苹果安装教程：手把手教你配置 OpenCore
  </label>
  
    <div class="md-nav__source">
      <a href="https://github.com/sqlsec/Hackintosh" title="前往仓库" class="md-source" data-md-component="source">
  <div class="md-source__icon md-icon">
    
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
  </div>
  <div class="md-source__repository">
    sqlsec/Hackintosh
  </div>
</a>
    </div>
  
  <ul class="md-nav__list" data-md-scrollfix>
    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href="../.." class="md-nav__link">
        主页
      </a>
    </li>
  

    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
        <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_2" type="checkbox" id="__nav_2" >
      
      
      
      
        <label class="md-nav__link" for="__nav_2">
          前言介绍
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" aria-label="前言介绍" data-md-level="1">
        <label class="md-nav__title" for="__nav_2">
          <span class="md-nav__icon md-icon"></span>
          前言介绍
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../0-%E5%89%8D%E8%A8%80%E4%BB%8B%E7%BB%8D/0-1/" class="md-nav__link">
        背景
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../0-%E5%89%8D%E8%A8%80%E4%BB%8B%E7%BB%8D/0-2/" class="md-nav__link">
        啰嗦
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
        <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_3" type="checkbox" id="__nav_3" >
      
      
      
      
        <label class="md-nav__link" for="__nav_3">
          基础知识
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" aria-label="基础知识" data-md-level="1">
        <label class="md-nav__title" for="__nav_3">
          <span class="md-nav__icon md-icon"></span>
          基础知识
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../1-%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/1-1/" class="md-nav__link">
        基操勿六
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../1-%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/1-2/" class="md-nav__link">
        硬件限制
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../1-%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/1-3/" class="md-nav__link">
        寻找硬件
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../1-%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/1-4/" class="md-nav__link">
        专业术语
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
        <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_4" type="checkbox" id="__nav_4" >
      
      
      
      
        <label class="md-nav__link" for="__nav_4">
          U盘制作
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" aria-label="U盘制作" data-md-level="1">
        <label class="md-nav__title" for="__nav_4">
          <span class="md-nav__icon md-icon"></span>
          U盘制作
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../2-U%E7%9B%98%E5%88%B6%E4%BD%9C/2-1/" class="md-nav__link">
        下载镜像
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../2-U%E7%9B%98%E5%88%B6%E4%BD%9C/2-2/" class="md-nav__link">
        写入镜像
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../2-U%E7%9B%98%E5%88%B6%E4%BD%9C/2-3/" class="md-nav__link">
        结构讲解
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
        <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_5" type="checkbox" id="__nav_5" >
      
      
      
      
        <label class="md-nav__link" for="__nav_5">
          准备工作
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" aria-label="准备工作" data-md-level="1">
        <label class="md-nav__title" for="__nav_5">
          <span class="md-nav__icon md-icon"></span>
          准备工作
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../3-%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C/3-1/" class="md-nav__link">
        BIOS设置
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../3-%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C/3-2/" class="md-nav__link">
        OC 文件结构
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../3-%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C/3-3/" class="md-nav__link">
        准备 ACPI
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../3-%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C/3-4/" class="md-nav__link">
        准备 Kexts
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../3-%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C/3-5/" class="md-nav__link">
        Drivers 说明
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../3-%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C/3-6/" class="md-nav__link">
        OC 编辑器
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../3-%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C/3-7/" class="md-nav__link">
        初步配置
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../3-%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C/3-8/" class="md-nav__link">
        Kexts 微调
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
        <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_6" type="checkbox" id="__nav_6" >
      
      
      
      
        <label class="md-nav__link" for="__nav_6">
          配置 OC
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" aria-label="配置 OC" data-md-level="1">
        <label class="md-nav__title" for="__nav_6">
          <span class="md-nav__icon md-icon"></span>
          配置 OC
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../4-OC%E9%85%8D%E7%BD%AE/4-1/" class="md-nav__link">
        ACPI
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../4-OC%E9%85%8D%E7%BD%AE/4-2/" class="md-nav__link">
        Booter
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../4-OC%E9%85%8D%E7%BD%AE/4-3/" class="md-nav__link">
        DeviceProperties
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../4-OC%E9%85%8D%E7%BD%AE/4-4/" class="md-nav__link">
        Kernel
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../4-OC%E9%85%8D%E7%BD%AE/4-5/" class="md-nav__link">
        Misc
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../4-OC%E9%85%8D%E7%BD%AE/4-6/" class="md-nav__link">
        NVRAM
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../4-OC%E9%85%8D%E7%BD%AE/4-7/" class="md-nav__link">
        PlatformInfo
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../4-OC%E9%85%8D%E7%BD%AE/4-8/" class="md-nav__link">
        UEFI
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
        <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_7" type="checkbox" id="__nav_7" >
      
      
      
      
        <label class="md-nav__link" for="__nav_7">
          实战演示
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" aria-label="实战演示" data-md-level="1">
        <label class="md-nav__title" for="__nav_7">
          <span class="md-nav__icon md-icon"></span>
          实战演示
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../5-%E5%AE%9E%E6%88%98%E6%BC%94%E7%A4%BA/5-1/" class="md-nav__link">
        机器概览
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../5-%E5%AE%9E%E6%88%98%E6%BC%94%E7%A4%BA/5-2/" class="md-nav__link">
        BIOS 设置
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../5-%E5%AE%9E%E6%88%98%E6%BC%94%E7%A4%BA/5-3/" class="md-nav__link">
        磁盘划分
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../5-%E5%AE%9E%E6%88%98%E6%BC%94%E7%A4%BA/5-4/" class="md-nav__link">
        安装 Windows
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../5-%E5%AE%9E%E6%88%98%E6%BC%94%E7%A4%BA/5-5/" class="md-nav__link">
        安装 macOS
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../5-%E5%AE%9E%E6%88%98%E6%BC%94%E7%A4%BA/5-6/" class="md-nav__link">
        完善引导
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../5-%E5%AE%9E%E6%88%98%E6%BC%94%E7%A4%BA/5-7/" class="md-nav__link">
        更新系统
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
    
  
  
    
    <li class="md-nav__item md-nav__item--active md-nav__item--nested">
      
      
        <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_8" type="checkbox" id="__nav_8" checked>
      
      
      
      
        <label class="md-nav__link" for="__nav_8">
          实用姿势
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" aria-label="实用姿势" data-md-level="1">
        <label class="md-nav__title" for="__nav_8">
          <span class="md-nav__icon md-icon"></span>
          实用姿势
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../6-1/" class="md-nav__link">
        USB 定制
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../6-2/" class="md-nav__link">
        编译触控板驱动
      </a>
    </li>
  

            
          
            
              
  
  
    
  
  
    <li class="md-nav__item md-nav__item--active">
      
      <input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
      
      
      
        <label class="md-nav__link md-nav__link--active" for="__toc">
          触控板中断示例
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <a href="./" class="md-nav__link md-nav__link--active">
        触控板中断示例
      </a>
      
        

<nav class="md-nav md-nav--secondary" aria-label="目录">
  
  
  
  
    <label class="md-nav__title" for="__toc">
      <span class="md-nav__icon md-icon"></span>
      目录
    </label>
    <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
      
        <li class="md-nav__item">
  <a href="#_1" class="md-nav__link">
    前言
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_2" class="md-nav__link">
    硬件信息
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_3" class="md-nav__link">
    触控板的工作模式
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_4" class="md-nav__link">
    判断触控板的工作模式
  </a>
  
    <nav class="md-nav" aria-label="判断触控板的工作模式">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#dmesg" class="md-nav__link">
    查看 dmesg 日志
  </a>
  
    <nav class="md-nav" aria-label="查看 dmesg 日志">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#sip" class="md-nav__link">
    关闭 SIP
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#oc-kexts" class="md-nav__link">
    OC 里面禁用 Kexts
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#kexts" class="md-nav__link">
    手动加载 Kexts
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
        
          <li class="md-nav__item">
  <a href="#ioregistryexplore" class="md-nav__link">
    使用 IORegistryExplore
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#dsdt" class="md-nav__link">
    定制修补 DSDT
  </a>
  
    <nav class="md-nav" aria-label="定制修补 DSDT">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#dsdt_1" class="md-nav__link">
    提取 DSDT
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#dsdt_2" class="md-nav__link">
    DSDT 排错
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_5" class="md-nav__link">
    寻找触控板代码
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#gpio-pinning" class="md-nav__link">
    GPIO Pinning 固定
  </a>
  
    <nav class="md-nav" aria-label="GPIO Pinning 固定">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_6" class="md-nav__link">
    寻找触控板关键代码
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#sbfi" class="md-nav__link">
    重命名 SBFI
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#gpio-pin" class="md-nav__link">
    寻找 GPIO Pin
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#gpio" class="md-nav__link">
    添加 GPIO 模板
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_crs" class="md-nav__link">
    修改 _CRS 返回值
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#gpio-pin_1" class="md-nav__link">
    计算 GPIO Pin 值
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_7" class="md-nav__link">
    最终效果
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_8" class="md-nav__link">
    炫耀一下
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_9" class="md-nav__link">
    支持一下？
  </a>
  
</li>
      
    </ul>
  
</nav>
      
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../6-4/" class="md-nav__link">
        台式机双显卡显示
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../6-5/" class="md-nav__link">
        开启 HiDPi
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../6-6/" class="md-nav__link">
        睡眠问题排查
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../6-7/" class="md-nav__link">
        macOS 12 蓝牙
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../6-8/" class="md-nav__link">
        屏蔽不支持的硬盘
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../6-9/" class="md-nav__link">
        AMD 免驱独显优化
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../6-10/" class="md-nav__link">
        OC 主题与启动项
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../6-11/" class="md-nav__link">
        macOS 下触屏驱动
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../6-12/" class="md-nav__link">
        自定义显示器图标
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../6-13/" class="md-nav__link">
        核显接口输出定制
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
        <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_9" type="checkbox" id="__nav_9" >
      
      
      
      
        <label class="md-nav__link" for="__nav_9">
          完美黑果
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" aria-label="完美黑果" data-md-level="1">
        <label class="md-nav__title" for="__nav_9">
          <span class="md-nav__icon md-icon"></span>
          完美黑果
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../7-%E5%AE%8C%E7%BE%8E%E9%BB%91%E6%9E%9C/7-1/" class="md-nav__link">
        黑苹果
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../7-%E5%AE%8C%E7%BE%8E%E9%BB%91%E6%9E%9C/7-2/" class="md-nav__link">
        白苹果
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
        <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_10" type="checkbox" id="__nav_10" >
      
      
      
      
        <label class="md-nav__link" for="__nav_10">
          OC排错
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" aria-label="OC排错" data-md-level="1">
        <label class="md-nav__title" for="__nav_10">
          <span class="md-nav__icon md-icon"></span>
          OC排错
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../8-OC%E6%8E%92%E9%94%99/8-1/" class="md-nav__link">
        正常日志
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../8-OC%E6%8E%92%E9%94%99/8-2/" class="md-nav__link">
        异常日志
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
        <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_11" type="checkbox" id="__nav_11" >
      
      
      
      
        <label class="md-nav__link" for="__nav_11">
          成果分享
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" aria-label="成果分享" data-md-level="1">
        <label class="md-nav__title" for="__nav_11">
          <span class="md-nav__icon md-icon"></span>
          成果分享
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../9-%E6%88%90%E6%9E%9C%E5%88%86%E4%BA%AB/9-1/" class="md-nav__link">
        ITX QQLS
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
        <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_12" type="checkbox" id="__nav_12" >
      
      
      
      
        <label class="md-nav__link" for="__nav_12">
          常见 QA
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" aria-label="常见 QA" data-md-level="1">
        <label class="md-nav__title" for="__nav_12">
          <span class="md-nav__icon md-icon"></span>
          常见 QA
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../10-%E5%B8%B8%E8%A7%81QA/10-1/" class="md-nav__link">
        使用方法
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../10-%E5%B8%B8%E8%A7%81QA/10-2/" class="md-nav__link">
        问题列表
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
  </ul>
</nav>
                  </div>
                </div>
              </div>
            
            
              
              <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    

<nav class="md-nav md-nav--secondary" aria-label="目录">
  
  
  
  
    <label class="md-nav__title" for="__toc">
      <span class="md-nav__icon md-icon"></span>
      目录
    </label>
    <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
      
        <li class="md-nav__item">
  <a href="#_1" class="md-nav__link">
    前言
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_2" class="md-nav__link">
    硬件信息
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_3" class="md-nav__link">
    触控板的工作模式
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_4" class="md-nav__link">
    判断触控板的工作模式
  </a>
  
    <nav class="md-nav" aria-label="判断触控板的工作模式">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#dmesg" class="md-nav__link">
    查看 dmesg 日志
  </a>
  
    <nav class="md-nav" aria-label="查看 dmesg 日志">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#sip" class="md-nav__link">
    关闭 SIP
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#oc-kexts" class="md-nav__link">
    OC 里面禁用 Kexts
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#kexts" class="md-nav__link">
    手动加载 Kexts
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
        
          <li class="md-nav__item">
  <a href="#ioregistryexplore" class="md-nav__link">
    使用 IORegistryExplore
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#dsdt" class="md-nav__link">
    定制修补 DSDT
  </a>
  
    <nav class="md-nav" aria-label="定制修补 DSDT">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#dsdt_1" class="md-nav__link">
    提取 DSDT
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#dsdt_2" class="md-nav__link">
    DSDT 排错
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_5" class="md-nav__link">
    寻找触控板代码
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#gpio-pinning" class="md-nav__link">
    GPIO Pinning 固定
  </a>
  
    <nav class="md-nav" aria-label="GPIO Pinning 固定">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_6" class="md-nav__link">
    寻找触控板关键代码
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#sbfi" class="md-nav__link">
    重命名 SBFI
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#gpio-pin" class="md-nav__link">
    寻找 GPIO Pin
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#gpio" class="md-nav__link">
    添加 GPIO 模板
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_crs" class="md-nav__link">
    修改 _CRS 返回值
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#gpio-pin_1" class="md-nav__link">
    计算 GPIO Pin 值
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_7" class="md-nav__link">
    最终效果
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_8" class="md-nav__link">
    炫耀一下
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_9" class="md-nav__link">
    支持一下？
  </a>
  
</li>
      
    </ul>
  
</nav>
                  </div>
                </div>
              </div>
            
          
          
            <div class="md-content" data-md-component="content">
              <article class="md-content__inner md-typeset">
                
                  

  <a href="https://github.com/sqlsec/Hackintosh/edit/main/docs/6-实用姿势/6-3.md" title="编辑此页" class="md-content__button md-icon">
    
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25Z"/></svg>
  </a>


  <h1>触控板中断示例</h1>

<h2 id="_1">前言<a class="headerlink" href="#_1" title="Permanent link">&para;</a></h2>
<p>当你看到这部分内容的时候，表示你黑苹果已经研究的比较深了，触控板工作在轮询模式下已经无法满足你了，非得搞个 GPIO 中断才满意。实际上这块内容搬运自我博客的这篇文章：<a href="https://www.sqlsec.com/2021/12/screenpad.html">双屏笔记本在 macOS 下的触控板驱动研究</a> </p>
<p>由于文章比较长，所以就从里面提起关键的部分放到了这个教程里面，感兴趣的朋友也可以去原文观看一下。下面直接开始触控板中断教程的部分。</p>
<h2 id="_2">硬件信息<a class="headerlink" href="#_2" title="Permanent link">&para;</a></h2>
<p>中断之前先收集一下自己触控板的基础信息，先在 Windows 下对触控板信息进行一个简短的整理，使用的是标准的符合微软 I2C 协议触控板：</p>
<p><img alt="" src="https://image.3001.net/images/20211219/16399193918328.png" /> </p>
<p>在 macOS 下使用<a href="https://github.com/vulgo/IORegistryExplorer">IORegistryExplorer</a>也是可识别到触控板的型号为：<strong>GDX1515</strong></p>
<p><img alt="" src="https://image.3001.net/images/20211219/16399186829443.png" /> </p>
<p>将以上可能有用的信息整理出来如下：</p>
<ul>
<li><strong>Windows 下这种二合一触控板叫法</strong>：ScreenPad</li>
<li><strong>触控板型号</strong>：GDX1515</li>
<li><strong>触控板的屏幕型号</strong>：ScreenXpert</li>
<li><strong>IRQ</strong>：<code>0x0000006D (109)</code></li>
<li><strong>APIC Pin</strong>：<code>6d（109）</code></li>
<li><strong>设备实例路径</strong>：<code>ACPI\GDX1515\1</code></li>
<li><strong>硬件 Id</strong>：</li>
<li><code>ACPI\VEN_GDX&amp;DEV_1515</code></li>
<li><code>ACPI\GDX1515</code></li>
<li><code>*GDX1515</code></li>
<li><strong>BIOS 设备名称</strong>：<code>\_SB.PCI0.I2C1.ETPD</code></li>
<li><strong>位置路径</strong>：</li>
<li><code>ACPI(_SB)#ACPI(PCI0)#(I2C1)#ACPI(ETPD)</code></li>
<li><code>ACPI(_SB)#ACPI(USBX)#(I2C1)#ACPI(ETPD)</code></li>
</ul>
<h2 id="_3">触控板的工作模式<a class="headerlink" href="#_3" title="Permanent link">&para;</a></h2>
<p>比较完美的情况是让触控板工作在中断模式（interrupts）下，关于轮询和中断可以参考下面几个概念：</p>
<ul>
<li>APIC 中断</li>
<li>macOS 使用的中断模式，功能完美，极少数设备支持</li>
<li>只有 APIC Pin 值小于 <code>2F (47)</code>的时候才支持</li>
<li>GPIO 中断</li>
<li>Windows 系统下大多使用的中断模式</li>
<li>仅次于 APIC 中断，比较高效，但是需要自己更改定制 SSDT</li>
<li>轮询</li>
<li>比较低效的模式</li>
<li>但是兼容性比较好，大部分触控板都适用</li>
<li>容易出现指针漂移等不灵敏的 BUG</li>
</ul>
<p>那我们目前的触控板工作在啥模式情况下呢？通过前面的信息收集，我们知道触控板的 APIC Pin 值为：</p>
<ul>
<li><strong>IRQ</strong>：<code>0x0000006D (109)</code></li>
<li><strong>APIC Pin</strong>：<code>6d（109）</code></li>
</ul>
<h2 id="_4">判断触控板的工作模式<a class="headerlink" href="#_4" title="Permanent link">&para;</a></h2>
<p>那么如何判断当前触控板的工作模式呢？目前有下面 3 种方法：</p>
<h3 id="dmesg">查看 dmesg 日志<a class="headerlink" href="#dmesg" title="Permanent link">&para;</a></h3>
<p>顺利的情况下使用 dmesg 命令可以直接根据触控板型号的关键词可以搜索到中断还是轮询的工作状态：</p>
<p><img alt="" src="https://image.3001.net/images/20211220/16399882815239.png" /> </p>
<p>但是黑苹果总不会一帆风顺的，正如你所见，dmesg 查看的日志结果为空的，这是因为 macOS 12.0 系统限制了 dmesg 查看的内容，我们这里需要手动加载 kexts 来查看日志。</p>
<h4 id="sip">关闭 SIP<a class="headerlink" href="#sip" title="Permanent link">&para;</a></h4>
<p>很多 OC 的配置默认是开启 SIP 的，因为我们要加载自己的 Kexts，所以需要在开机选择系统的界面手动切换下 SIP 状态：</p>
<p><img alt="" src="https://image.3001.net/images/20211220/1639988468424.jpeg" /> </p>
<p>如果你的 OC 没有这个选项，是因为没有勾选这个配置开关，具体细节可以参考我的这部分文章：<a href="https://apple.sqlsec.com/4-OC配置/4-5.html">国光的黑苹果安装教程：手把手教你配置 OpenCore</a> </p>
<h4 id="oc-kexts">OC 里面禁用 Kexts<a class="headerlink" href="#oc-kexts" title="Permanent link">&para;</a></h4>
<p>通过 OpenCore 注入的 kexts 是无法正常看到 dmesg 日志的，所以我们需要手动禁用下相关的 kexts：</p>
<p><img alt="" src="https://image.3001.net/images/20211220/16399886935508.png" /> </p>
<h4 id="kexts">手动加载 Kexts<a class="headerlink" href="#kexts" title="Permanent link">&para;</a></h4>
<p>将 <code>VoodooI2C.kext</code> 和 <code>VoodooI2CHID.kext</code> 拷贝到桌面上，然后执行以下命令：</p>
<div class="highlight"><pre><span></span><code><span class="c1"># 修改所有者</span>
sudo chown -R root:wheel VoodooI2C*

<span class="c1"># 修改权限</span>
sudo chmod -R <span class="m">755</span> VoodooI2C*

<span class="c1"># 加载 kexts</span>
sudo kextload -v VoodooI2C*
</code></pre></div>
<p>当然第一次加载 kexts 得在设置的「安全性与隐私」里面同意下权限，然后重启下电脑才可以成功加载： </p>
<p><img alt="" src="https://image.3001.net/images/20211220/16399905575583.png" /> </p>
<p>经过上述折腾，最终查看的效果如下：</p>
<p><img alt="" src="https://image.3001.net/images/20211220/16399893773012.png" /> </p>
<p>可以看到通过 dmesg 日志可以发现此 GDX1515 触控板工作在 polling 模式下，即轮询模式。</p>
<blockquote>
<p>关于日志的查看细节，下面会单独开个子目录详细介绍。</p>
</blockquote>
<h3 id="ioregistryexplore">使用 IORegistryExplore<a class="headerlink" href="#ioregistryexplore" title="Permanent link">&para;</a></h3>
<p>上面的方法可能有点繁琐，实际上使用<a href="https://github.com/vulgo/IORegistryExplorer">IORegistryExplorer</a>也是直接看到当前触控板的工作状态的，因为在 Windows 的设备管理器下我的触控板的位置路径为：</p>
<ul>
<li><code>ACPI(_SB)#ACPI(PCI0)#(I2C1)#ACPI(ETPD)</code></li>
<li><code>ACPI(_SB)#ACPI(USBX)#(I2C1)#ACPI(ETPD)</code></li>
</ul>
<p>所以搜索 <code>ETPD</code> 可以看到我们触控板的详细信息，一般会搜索出两个结果，下面是第一个结果：</p>
<p><img alt="" src="https://image.3001.net/images/20211220/1639989561260.png" /> </p>
<p>不过第一个结果没有参考价值，我们一般关注搜索出来的第 2 个结果：</p>
<p><img alt="" src="https://image.3001.net/images/20211221/1640052163711.png" /> </p>
<p>像上面这个图就是一个典型的没有工作在中断模式的情况。</p>
<p>这个时候肯定有网友会问，如果是 GPIO 中断模式的话，那这里应该长啥样子呢？</p>
<p>2333 这个问题问的不错，国光请教了 <a href="https://github.com/williambj1">Bat.bat</a> 大佬，下面是大佬的原话：</p>
<hr />
<p>代码里走到 GPIO 会有个 set property 把 IRQ 和 Pin 写到 ioreg 下，所以使用 IORegistryExplorer 查看的话，关注是否有这两个新增的属性即可。</p>
<hr />
<p>说到这里可能还有网友不是很明白，下面国光我帖一个处于 GPIO 中断模式下的 IORegistryExplorer 截图，大家应该就懂了：</p>
<p><img alt="" src="https://image.3001.net/images/20211220/16399899139722.jpeg" /> </p>
<h2 id="dsdt">定制修补 DSDT<a class="headerlink" href="#dsdt" title="Permanent link">&para;</a></h2>
<h3 id="dsdt_1">提取 DSDT<a class="headerlink" href="#dsdt_1" title="Permanent link">&para;</a></h3>
<p>因为制作触控板肯定是需要定制 SSDT 的，所以提取出主板原始的 DSDT 少不了。</p>
<p>提取 DSDT 的方法有很多，可以使用 Clover，Windows 下可以使用 AIDA64，macOS 下可以使用 <a href="https://github.com/MuntashirAkon/DPCIManager">DPCIManager</a> ，直接打开点击左上角的「Extract DSDT」即可：</p>
<p><img alt="" src="https://image.3001.net/images/20211220/16399912929359.png" /> </p>
<h3 id="dsdt_2">DSDT 排错<a class="headerlink" href="#dsdt_2" title="Permanent link">&para;</a></h3>
<p>可以使用 OC 直接在 ACPI 里面加载 DSDT，也可以将 DSDT 里面触控板的相关代码单独提取出来，保存为 SSDT 文件。两个方法都可以，这里国光我是直接在 DSDT 这里修改的（简单粗暴）。</p>
<p>DSDT 排错的话这里要使用必备的 <a href="https://github.com/acidanthera/MaciASL">MaciASL</a> 这个软件，直接点击「Compile」编译即可，如果没猜错的话肯定会有一堆报错：</p>
<p><img alt="" src="https://image.3001.net/images/20211220/16399924216669.png" /> </p>
<p>这是因为每家主板的 DSDT 的 ACPI 规范不统一，所以我们得根据自己的编程经验去修改报错，这块不太好写文章描述出来，因为每个主板都不一样，国光我这里的报错还算比较容易理解，我直接删掉了这些<code>Zero</code> 代码即可，23333（具体排错得根据对应报错情况来）</p>
<p>最终成功 0 errors 了：</p>
<p><img alt="" src="https://image.3001.net/images/20211220/16399927496136.jpeg" /> </p>
<p>DSDT 没问题的话就可以直接使用 OC 加载了：</p>
<p><img alt="" src="https://image.3001.net/images/20211221/16400533116218.png" /> </p>
<h2 id="_5">寻找触控板代码<a class="headerlink" href="#_5" title="Permanent link">&para;</a></h2>
<p>因为根据前面的信息收集，我们知道了触控板的路径为 <code>ETPD</code>，所以直接搜索 ETPD 即可找到触控板的代码，</p>
<p>发现左下角的路径也满足我们上面信息收集（<code>ACPI(_SB)#ACPI(PCI0)#(I2C1)#ACPI(ETPD)</code>）的情况：</p>
<p><img alt="" src="https://image.3001.net/images/20211220/1639993158804.jpeg" /> </p>
<p>下面将触控板的代码部分贴出来：</p>
<div class="highlight"><pre><span></span><code><span class="n">Scope</span><span class="w"> </span><span class="p">(</span><span class="n">_SB</span><span class="p">.</span><span class="n">PCI0</span><span class="p">.</span><span class="n">I2C1</span><span class="p">)</span><span class="w"></span>
<span class="w">    </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">Device</span><span class="w"> </span><span class="p">(</span><span class="n">ETPD</span><span class="p">)</span><span class="w"></span>
<span class="w">        </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="n">Name</span><span class="w"> </span><span class="p">(</span><span class="n">_ADR</span><span class="p">,</span><span class="w"> </span><span class="n">One</span><span class="p">)</span><span class="w">  </span><span class="c1">// _ADR: Address</span>
<span class="w">            </span><span class="n">Name</span><span class="w"> </span><span class="p">(</span><span class="n">ETPH</span><span class="p">,</span><span class="w"> </span><span class="n">Package</span><span class="w"> </span><span class="p">(</span><span class="mh">0x01</span><span class="p">)</span><span class="w"></span>
<span class="w">            </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="s">&quot;ASUE1407&quot;</span><span class="w"></span>
<span class="w">            </span><span class="p">})</span><span class="w"></span>
<span class="w">            </span><span class="n">Name</span><span class="w"> </span><span class="p">(</span><span class="n">FTPH</span><span class="p">,</span><span class="w"> </span><span class="n">Package</span><span class="w"> </span><span class="p">(</span><span class="mh">0x09</span><span class="p">)</span><span class="w"></span>
<span class="w">            </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="s">&quot;FTE1001&quot;</span><span class="p">,</span><span class="w"> </span>
<span class="w">                </span><span class="s">&quot;FTE1200&quot;</span><span class="p">,</span><span class="w"> </span>
<span class="w">                </span><span class="s">&quot;FTE1200&quot;</span><span class="p">,</span><span class="w"> </span>
<span class="w">                </span><span class="s">&quot;FTE1300&quot;</span><span class="p">,</span><span class="w"> </span>
<span class="w">                </span><span class="s">&quot;FTE1300&quot;</span><span class="p">,</span><span class="w"> </span>
<span class="w">                </span><span class="s">&quot;FTE1201&quot;</span><span class="p">,</span><span class="w"> </span>
<span class="w">                </span><span class="s">&quot;FTE1200&quot;</span><span class="p">,</span><span class="w"> </span>
<span class="w">                </span><span class="s">&quot;FTE1200&quot;</span><span class="p">,</span><span class="w"> </span>
<span class="w">                </span><span class="s">&quot;FTE1200&quot;</span><span class="w"></span>
<span class="w">            </span><span class="p">})</span><span class="w"></span>
<span class="w">            </span><span class="n">Name</span><span class="w"> </span><span class="p">(</span><span class="n">GTPH</span><span class="p">,</span><span class="w"> </span><span class="n">Package</span><span class="w"> </span><span class="p">(</span><span class="mh">0x05</span><span class="p">)</span><span class="w"></span>
<span class="w">            </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="s">&quot;GDX1505&quot;</span><span class="p">,</span><span class="w"> </span>
<span class="w">                </span><span class="s">&quot;GDX1300&quot;</span><span class="p">,</span><span class="w"> </span>
<span class="w">                </span><span class="s">&quot;GDX1200&quot;</span><span class="p">,</span><span class="w"> </span>
<span class="w">                </span><span class="s">&quot;GDX1301&quot;</span><span class="p">,</span><span class="w"> </span>
<span class="w">                </span><span class="s">&quot;GDX1515&quot;</span><span class="w"></span>
<span class="w">            </span><span class="p">})</span><span class="w"></span>
<span class="w">            </span><span class="n">Method</span><span class="w"> </span><span class="p">(</span><span class="n">_HID</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">NotSerialized</span><span class="p">)</span><span class="w">  </span><span class="c1">// _HID: Hardware ID</span>
<span class="w">            </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="n">If</span><span class="w"> </span><span class="p">(</span><span class="n">And</span><span class="w"> </span><span class="p">(</span><span class="n">TPDI</span><span class="p">,</span><span class="w"> </span><span class="mh">0x04</span><span class="p">))</span><span class="w"></span>
<span class="w">                </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="n">Return</span><span class="w"> </span><span class="p">(</span><span class="n">DerefOf</span><span class="w"> </span><span class="p">(</span><span class="n">Index</span><span class="w"> </span><span class="p">(</span><span class="n">ETPH</span><span class="p">,</span><span class="w"> </span><span class="n">TPHI</span><span class="p">)))</span><span class="w"></span>
<span class="w">                </span><span class="p">}</span><span class="w"></span>

<span class="w">                </span><span class="n">If</span><span class="w"> </span><span class="p">(</span><span class="n">And</span><span class="w"> </span><span class="p">(</span><span class="n">TPDI</span><span class="p">,</span><span class="w"> </span><span class="mh">0x10</span><span class="p">))</span><span class="w"></span>
<span class="w">                </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="n">Return</span><span class="w"> </span><span class="p">(</span><span class="n">DerefOf</span><span class="w"> </span><span class="p">(</span><span class="n">Index</span><span class="w"> </span><span class="p">(</span><span class="n">FTPH</span><span class="p">,</span><span class="w"> </span><span class="n">TPHI</span><span class="p">)))</span><span class="w"></span>
<span class="w">                </span><span class="p">}</span><span class="w"></span>

<span class="w">                </span><span class="n">If</span><span class="w"> </span><span class="p">(</span><span class="n">And</span><span class="w"> </span><span class="p">(</span><span class="n">TPDI</span><span class="p">,</span><span class="w"> </span><span class="mh">0x40</span><span class="p">))</span><span class="w"></span>
<span class="w">                </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="n">Return</span><span class="w"> </span><span class="p">(</span><span class="n">DerefOf</span><span class="w"> </span><span class="p">(</span><span class="n">Index</span><span class="w"> </span><span class="p">(</span><span class="n">GTPH</span><span class="p">,</span><span class="w"> </span><span class="n">TPHI</span><span class="p">)))</span><span class="w"></span>
<span class="w">                </span><span class="p">}</span><span class="w"></span>

<span class="w">                </span><span class="n">Return</span><span class="w"> </span><span class="p">(</span><span class="s">&quot;ELAN1010&quot;</span><span class="p">)</span><span class="w"></span>
<span class="w">            </span><span class="p">}</span><span class="w"></span>

<span class="w">            </span><span class="n">Name</span><span class="w"> </span><span class="p">(</span><span class="n">_CID</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;PNP0C50&quot;</span><span class="p">)</span><span class="w">  </span><span class="c1">// _CID: Compatible ID</span>
<span class="w">            </span><span class="n">Name</span><span class="w"> </span><span class="p">(</span><span class="n">_UID</span><span class="p">,</span><span class="w"> </span><span class="n">One</span><span class="p">)</span><span class="w">  </span><span class="c1">// _UID: Unique ID</span>
<span class="w">            </span><span class="n">Name</span><span class="w"> </span><span class="p">(</span><span class="n">_S0W</span><span class="p">,</span><span class="w"> </span><span class="mh">0x03</span><span class="p">)</span><span class="w">  </span><span class="c1">// _S0W: S0 Device Wake State</span>
<span class="w">            </span><span class="n">Method</span><span class="w"> </span><span class="p">(</span><span class="n">_DSM</span><span class="p">,</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w"> </span><span class="n">NotSerialized</span><span class="p">)</span><span class="w">  </span><span class="c1">// _DSM: Device-Specific Method</span>
<span class="w">            </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="n">If</span><span class="w"> </span><span class="p">(</span><span class="n">LEqual</span><span class="w"> </span><span class="p">(</span><span class="n">Arg0</span><span class="p">,</span><span class="w"> </span><span class="n">ToUUID</span><span class="w"> </span><span class="p">(</span><span class="s">&quot;3cdff6f7-4267-4555-ad05-b30a3d8938de&quot;</span><span class="p">)</span><span class="w"> </span><span class="cm">/* HID I2C Device */</span><span class="p">))</span><span class="w"></span>
<span class="w">                </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="n">If</span><span class="w"> </span><span class="p">(</span><span class="n">LEqual</span><span class="w"> </span><span class="p">(</span><span class="n">Arg2</span><span class="p">,</span><span class="w"> </span><span class="n">Zero</span><span class="p">))</span><span class="w"></span>
<span class="w">                    </span><span class="p">{</span><span class="w"></span>
<span class="w">                        </span><span class="n">If</span><span class="w"> </span><span class="p">(</span><span class="n">LEqual</span><span class="w"> </span><span class="p">(</span><span class="n">Arg1</span><span class="p">,</span><span class="w"> </span><span class="n">One</span><span class="p">))</span><span class="w"></span>
<span class="w">                        </span><span class="p">{</span><span class="w"></span>
<span class="w">                            </span><span class="n">Return</span><span class="w"> </span><span class="p">(</span><span class="n">Buffer</span><span class="w"> </span><span class="p">(</span><span class="n">One</span><span class="p">)</span><span class="w"></span>
<span class="w">                            </span><span class="p">{</span><span class="w"></span>
<span class="w">                                 </span><span class="mh">0x03</span><span class="w">                                           </span>
<span class="w">                            </span><span class="p">})</span><span class="w"></span>
<span class="w">                        </span><span class="p">}</span><span class="w"></span>
<span class="w">                        </span><span class="n">Else</span><span class="w"></span>
<span class="w">                        </span><span class="p">{</span><span class="w"></span>
<span class="w">                            </span><span class="n">Return</span><span class="w"> </span><span class="p">(</span><span class="n">Buffer</span><span class="w"> </span><span class="p">(</span><span class="n">One</span><span class="p">)</span><span class="w"></span>
<span class="w">                            </span><span class="p">{</span><span class="w"></span>
<span class="w">                                 </span><span class="mh">0x00</span><span class="w">                                           </span>
<span class="w">                            </span><span class="p">})</span><span class="w"></span>
<span class="w">                        </span><span class="p">}</span><span class="w"></span>
<span class="w">                    </span><span class="p">}</span><span class="w"></span>

<span class="w">                  </span><span class="n">If</span><span class="w"> </span><span class="p">(</span><span class="n">LEqual</span><span class="w"> </span><span class="p">(</span><span class="n">Arg2</span><span class="p">,</span><span class="w"> </span><span class="n">One</span><span class="p">))</span><span class="w"></span>
<span class="w">                    </span><span class="p">{</span><span class="w"></span>
<span class="w">                        </span><span class="n">Return</span><span class="w"> </span><span class="p">(</span><span class="n">One</span><span class="p">)</span><span class="w"></span>
<span class="w">                        </span><span class="p">}</span><span class="w"></span>
<span class="w">                    </span><span class="p">}</span><span class="w"></span>
<span class="w">                    </span><span class="n">Else</span><span class="w"></span>
<span class="w">                    </span><span class="p">{</span><span class="w"></span>
<span class="w">                        </span><span class="n">Return</span><span class="w"> </span><span class="p">(</span><span class="n">Buffer</span><span class="w"> </span><span class="p">(</span><span class="n">One</span><span class="p">)</span><span class="w"></span>
<span class="w">                        </span><span class="p">{</span><span class="w"></span>
<span class="w">                             </span><span class="mh">0x00</span><span class="w">                                           </span>
<span class="w">                        </span><span class="p">})</span><span class="w"></span>
<span class="w">                    </span><span class="p">}</span><span class="w"></span>
<span class="w">                </span><span class="p">}</span><span class="w"></span>
<span class="w">          </span><span class="n">Method</span><span class="w"> </span><span class="p">(</span><span class="n">_STA</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">NotSerialized</span><span class="p">)</span><span class="w">  </span><span class="c1">// _STA: Status</span>
<span class="w">          </span><span class="p">{</span><span class="w"></span>
<span class="w">                      </span><span class="n">If</span><span class="w"> </span><span class="p">(</span><span class="n">LOr</span><span class="w"> </span><span class="p">(</span><span class="n">LNotEqual</span><span class="w"> </span><span class="p">(</span><span class="n">TPIF</span><span class="p">,</span><span class="w"> </span><span class="n">One</span><span class="p">),</span><span class="w"> </span><span class="n">LAnd</span><span class="w"> </span><span class="p">(</span><span class="n">DSYN</span><span class="p">,</span><span class="w"> </span><span class="n">One</span><span class="p">)))</span><span class="w"></span>
<span class="w">                      </span><span class="p">{</span><span class="w"></span>
<span class="w">                          </span><span class="n">Return</span><span class="w"> </span><span class="p">(</span><span class="n">Zero</span><span class="p">)</span><span class="w"></span>
<span class="w">                      </span><span class="p">}</span><span class="w"></span>

<span class="w">                      </span><span class="n">Return</span><span class="w"> </span><span class="p">(</span><span class="mh">0x0F</span><span class="p">)</span><span class="w"></span>
<span class="w">               </span><span class="p">}</span><span class="w"></span>

<span class="w">          </span><span class="n">Method</span><span class="w"> </span><span class="p">(</span><span class="n">_CRS</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">Serialized</span><span class="p">)</span><span class="w">  </span><span class="c1">// _CRS: Current Resource Settings</span>
<span class="w">          </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="n">Name</span><span class="w"> </span><span class="p">(</span><span class="n">SBFI</span><span class="p">,</span><span class="w"> </span><span class="n">ResourceTemplate</span><span class="w"> </span><span class="p">()</span><span class="w"></span>
<span class="w">                </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="n">I2cSerialBusV2</span><span class="w"> </span><span class="p">(</span><span class="mh">0x0015</span><span class="p">,</span><span class="w"> </span><span class="n">ControllerInitiated</span><span class="p">,</span><span class="w"> </span><span class="mh">0x00061A80</span><span class="p">,</span><span class="w"></span>
<span class="w">                        </span><span class="n">AddressingMode7Bit</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;</span><span class="se">\\</span><span class="s">_SB.PCI0.I2C1&quot;</span><span class="p">,</span><span class="w"></span>
<span class="w">                        </span><span class="mh">0x00</span><span class="p">,</span><span class="w"> </span><span class="n">ResourceConsumer</span><span class="p">,</span><span class="w"> </span><span class="p">,</span><span class="w"> </span><span class="n">Exclusive</span><span class="p">,</span><span class="w"></span>
<span class="w">                        </span><span class="p">)</span><span class="w"></span>
<span class="w">                    </span><span class="n">Interrupt</span><span class="w"> </span><span class="p">(</span><span class="n">ResourceConsumer</span><span class="p">,</span><span class="w"> </span><span class="n">Level</span><span class="p">,</span><span class="w"> </span><span class="n">ActiveLow</span><span class="p">,</span><span class="w"> </span><span class="n">Exclusive</span><span class="p">,</span><span class="w"> </span><span class="p">,,</span><span class="w"> </span><span class="p">)</span><span class="w"></span>
<span class="w">                    </span><span class="p">{</span><span class="w"></span>
<span class="w">                        </span><span class="mh">0x0000006D</span><span class="p">,</span><span class="w"></span>
<span class="w">                    </span><span class="p">}</span><span class="w"></span>
<span class="w">                </span><span class="p">})</span><span class="w"></span>
<span class="w">                </span><span class="n">Return</span><span class="w"> </span><span class="p">(</span><span class="n">SBFI</span><span class="p">)</span><span class="w"></span>
<span class="w">            </span><span class="p">}</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<h2 id="gpio-pinning">GPIO Pinning 固定<a class="headerlink" href="#gpio-pinning" title="Permanent link">&para;</a></h2>
<p>国光这里只介绍如何定制 GPIO 中断，轮询和其他模式不在本文的范畴内。</p>
<h3 id="_6">寻找触控板关键代码<a class="headerlink" href="#_6" title="Permanent link">&para;</a></h3>
<p>根据<code>_CRS</code>方法这个特征，我们可以很容易直找到触控板代码中类似如下的代码片段：</p>
<div class="highlight"><pre><span></span><code><span class="n">Method</span><span class="w"> </span><span class="p">(</span><span class="n">_CRS</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">Serialized</span><span class="p">)</span><span class="w">  </span><span class="c1">// _CRS: Current Resource Settings</span>
<span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="n">Name</span><span class="w"> </span><span class="p">(</span><span class="n">SBFI</span><span class="p">,</span><span class="w"> </span><span class="n">ResourceTemplate</span><span class="w"> </span><span class="p">()</span><span class="w"></span>
<span class="w">        </span><span class="p">{</span><span class="w"></span>
<span class="w">          </span><span class="n">I2cSerialBusV2</span><span class="w"> </span><span class="p">(</span><span class="mh">0x0015</span><span class="p">,</span><span class="w"> </span><span class="n">ControllerInitiated</span><span class="p">,</span><span class="w"> </span><span class="mh">0x00061A80</span><span class="p">,</span><span class="w"></span>
<span class="w">                          </span><span class="n">AddressingMode7Bit</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;</span><span class="se">\\</span><span class="s">_SB.PCI0.I2C1&quot;</span><span class="p">,</span><span class="w"></span>
<span class="w">                          </span><span class="mh">0x00</span><span class="p">,</span><span class="w"> </span><span class="n">ResourceConsumer</span><span class="p">,</span><span class="w"> </span><span class="p">,</span><span class="w"> </span><span class="n">Exclusive</span><span class="p">,</span><span class="w"></span>
<span class="w">                         </span><span class="p">)</span><span class="w"></span>
<span class="w">            </span><span class="n">Interrupt</span><span class="w"> </span><span class="p">(</span><span class="n">ResourceConsumer</span><span class="p">,</span><span class="w"> </span><span class="n">Level</span><span class="p">,</span><span class="w"> </span><span class="n">ActiveLow</span><span class="p">,</span><span class="w"> </span><span class="n">Exclusive</span><span class="p">,</span><span class="w"> </span><span class="p">,,</span><span class="w"> </span><span class="p">)</span><span class="w"></span>
<span class="w">          </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="mh">0x0000006D</span><span class="p">,</span><span class="w"></span>
<span class="w">          </span><span class="p">}</span><span class="w"></span>
<span class="w">        </span><span class="p">})</span><span class="w"></span>
<span class="w">    </span><span class="n">Return</span><span class="w"> </span><span class="p">(</span><span class="n">SBFI</span><span class="p">)</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<h3 id="sbfi">重命名 SBFI<a class="headerlink" href="#sbfi" title="Permanent link">&para;</a></h3>
<p>VoodooI2C 在以 GPIO 中断模式调用 DSDT 中触摸设备的_CRS 方法时，一律使用 <code>SBFG</code> 参数而不是 <code>SBFI</code> 参数。所以我们目前的触控板代码里面的 <code>SBFI</code> 变量是不满足要求的，我们先把 <code>SBFI</code>重命名为 <code>SBFB</code>，至于 <code>SBFG</code> 变量我们后面单独添加一下（如果你的 DSDT 里面没有的话）。</p>
<div class="highlight"><pre><span></span><code><span class="n">Method</span><span class="w"> </span><span class="p">(</span><span class="n">_CRS</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">Serialized</span><span class="p">)</span><span class="w">  </span><span class="c1">// _CRS: Current Resource Settings</span>
<span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="n">Name</span><span class="w"> </span><span class="p">(</span><span class="n">SBFB</span><span class="p">,</span><span class="w"> </span><span class="n">ResourceTemplate</span><span class="w"> </span><span class="p">()</span><span class="w"></span>
<span class="w">        </span><span class="p">{</span><span class="w"></span>
<span class="w">          </span><span class="n">I2cSerialBusV2</span><span class="w"> </span><span class="p">(</span><span class="mh">0x0015</span><span class="p">,</span><span class="w"> </span><span class="n">ControllerInitiated</span><span class="p">,</span><span class="w"> </span><span class="mh">0x00061A80</span><span class="p">,</span><span class="w"></span>
<span class="w">                          </span><span class="n">AddressingMode7Bit</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;</span><span class="se">\\</span><span class="s">_SB.PCI0.I2C1&quot;</span><span class="p">,</span><span class="w"></span>
<span class="w">                          </span><span class="mh">0x00</span><span class="p">,</span><span class="w"> </span><span class="n">ResourceConsumer</span><span class="p">,</span><span class="w"> </span><span class="p">,</span><span class="w"> </span><span class="n">Exclusive</span><span class="p">,</span><span class="w"></span>
<span class="w">                         </span><span class="p">)</span><span class="w"></span>
<span class="w">  </span><span class="c1">//         Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, ,, )</span>

<span class="w">  </span><span class="c1">//        {</span>
<span class="w">  </span><span class="c1">//          0x0000006D,</span>
<span class="w">  </span><span class="c1">//        }</span>
<span class="w">        </span><span class="p">})</span><span class="w"></span>
<span class="w">    </span><span class="n">Return</span><span class="w"> </span><span class="p">(</span><span class="n">SBFB</span><span class="p">)</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>重命名后移除 <code>_CRS</code> 方法中的以下内容（即上面代码注释的部分）：</p>
<div class="highlight"><pre><span></span><code><span class="n">Interrupt</span><span class="w"> </span><span class="p">(</span><span class="n">ResourceConsumer</span><span class="p">,</span><span class="w"> </span><span class="n">Level</span><span class="p">,</span><span class="w"> </span><span class="n">ActiveLow</span><span class="p">,</span><span class="w"> </span><span class="n">Exclusive</span><span class="p">,</span><span class="w"> </span><span class="p">,,</span><span class="w"> </span><span class="p">)</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="mh">0x0000006D</span><span class="p">,</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<h3 id="gpio-pin">寻找 GPIO Pin<a class="headerlink" href="#gpio-pin" title="Permanent link">&para;</a></h3>
<p>在触控板的代码中寻找类似如下的代码片段：</p>
<div class="highlight"><pre><span></span><code><span class="n">Name</span><span class="w"> </span><span class="p">(</span><span class="n">SBFG</span><span class="p">,</span><span class="w"> </span><span class="n">ResourceTemplate</span><span class="w"> </span><span class="p">()</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">GpioInt</span><span class="w"> </span><span class="p">(</span><span class="n">Level</span><span class="p">,</span><span class="w"> </span><span class="n">ActiveLow</span><span class="p">,</span><span class="w"> </span><span class="n">ExclusiveAndWake</span><span class="p">,</span><span class="w"> </span><span class="n">PullDefault</span><span class="p">,</span><span class="w"> </span><span class="mh">0x0000</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="s">&quot;</span><span class="se">\\</span><span class="s">_SB.PCI0.GPI0&quot;</span><span class="p">,</span><span class="w"> </span><span class="mh">0x00</span><span class="p">,</span><span class="w"> </span><span class="n">ResourceConsumer</span><span class="p">,</span><span class="w"> </span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="p">)</span><span class="w"></span>
<span class="w">  </span><span class="p">{</span><span class="w">   </span><span class="c1">// Pin list</span>
<span class="w">      </span><span class="mh">0x0000</span><span class="w"></span>
<span class="w">  </span><span class="p">}</span><span class="w"></span>
<span class="p">})</span><span class="w"></span>
</code></pre></div>
<p>如果找到的话，那么恭喜你，你的设备可能都不需要计算 GPIO Pin 值。没有找到也没有关系，我们可以手动添加，具体参考下面内容。</p>
<h3 id="gpio">添加 GPIO 模板<a class="headerlink" href="#gpio" title="Permanent link">&para;</a></h3>
<p>很明显我的触控板搜索不到 GPIO 相关的代码，所以我们需要复制上面的代码片段，将其添加到 _CRS 方法下面：</p>
<div class="highlight"><pre><span></span><code><span class="n">Method</span><span class="w"> </span><span class="p">(</span><span class="n">_CRS</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">Serialized</span><span class="p">)</span><span class="w">  </span><span class="c1">// _CRS: Current Resource Settings</span>
<span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="n">Name</span><span class="w"> </span><span class="p">(</span><span class="n">SBFB</span><span class="p">,</span><span class="w"> </span><span class="n">ResourceTemplate</span><span class="w"> </span><span class="p">()</span><span class="w"></span>
<span class="w">        </span><span class="p">{</span><span class="w"></span>
<span class="w">          </span><span class="n">I2cSerialBusV2</span><span class="w"> </span><span class="p">(</span><span class="mh">0x0015</span><span class="p">,</span><span class="w"> </span><span class="n">ControllerInitiated</span><span class="p">,</span><span class="w"> </span><span class="mh">0x00061A80</span><span class="p">,</span><span class="w"></span>
<span class="w">                          </span><span class="n">AddressingMode7Bit</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;</span><span class="se">\\</span><span class="s">_SB.PCI0.I2C1&quot;</span><span class="p">,</span><span class="w"></span>
<span class="w">                          </span><span class="mh">0x00</span><span class="p">,</span><span class="w"> </span><span class="n">ResourceConsumer</span><span class="p">,</span><span class="w"> </span><span class="p">,</span><span class="w"> </span><span class="n">Exclusive</span><span class="p">,</span><span class="w"></span>
<span class="w">                         </span><span class="p">)</span><span class="w"></span>
<span class="w">        </span><span class="p">})</span><span class="w"></span>
<span class="w">    </span><span class="c1">// 下面是新增的 GPIO 模板代码片段</span>
<span class="w">    </span><span class="n">Name</span><span class="w"> </span><span class="p">(</span><span class="n">SBFG</span><span class="p">,</span><span class="w"> </span><span class="n">ResourceTemplate</span><span class="w"> </span><span class="p">()</span><span class="w"></span>
<span class="w">          </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="n">GpioInt</span><span class="w"> </span><span class="p">(</span><span class="n">Level</span><span class="p">,</span><span class="w"> </span><span class="n">ActiveLow</span><span class="p">,</span><span class="w"> </span><span class="n">ExclusiveAndWake</span><span class="p">,</span><span class="w"> </span><span class="n">PullDefault</span><span class="p">,</span><span class="w"> </span><span class="mh">0x0000</span><span class="p">,</span><span class="w"></span>
<span class="w">                     </span><span class="s">&quot;</span><span class="se">\\</span><span class="s">_SB.PCI0.GPI0&quot;</span><span class="p">,</span><span class="w"> </span><span class="mh">0x00</span><span class="p">,</span><span class="w"> </span><span class="n">ResourceConsumer</span><span class="p">,</span><span class="w"> </span><span class="p">,</span><span class="w"></span>
<span class="w">                    </span><span class="p">)</span><span class="w"></span>
<span class="w">            </span><span class="p">{</span><span class="w">   </span><span class="c1">// Pin list</span>
<span class="w">              </span><span class="mh">0x0000</span><span class="w">   </span><span class="c1">// 这个值 我们待会要计算一下</span>
<span class="w">            </span><span class="p">}</span><span class="w"></span>
<span class="w">          </span><span class="p">})</span><span class="w"></span>
<span class="w">    </span><span class="n">Return</span><span class="w"> </span><span class="p">(</span><span class="n">SBFB</span><span class="p">)</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<h3 id="_crs">修改 _CRS 返回值<a class="headerlink" href="#_crs" title="Permanent link">&para;</a></h3>
<p>因为我们 <code>_CRS</code> 方法里面还引入了 SBFG 变量，所以得将默认的 <code>Return (SBFB)</code> 返回值修改为：</p>
<div class="highlight"><pre><span></span><code><span class="n">Return</span><span class="w"> </span><span class="p">(</span><span class="n">ConcatenateResTemplate</span><span class="w"> </span><span class="p">(</span><span class="n">SBFB</span><span class="p">,</span><span class="w"> </span><span class="n">SBFG</span><span class="p">))</span><span class="w"></span>
</code></pre></div>
<blockquote>
<p><a href="https://github.com/williambj1">Bat.bat</a> 大佬原话：有 gpioint 的设备不用算 pin，没有的加上也基本上不可能成功，算 pin 其实是最后死马当活马医的方案。</p>
</blockquote>
<h3 id="gpio-pin_1">计算 GPIO Pin 值<a class="headerlink" href="#gpio-pin_1" title="Permanent link">&para;</a></h3>
<p>我们上面添加的模板中，GPIO Pin 值为 <code>0x0000</code>，这个一般是跑不起来的，只能起占位的作用，所以需要计算一个正确的 GPIO 值。这一步比较关键，不同的 CPU 有不同的计算公式，下面的这个公式也是 <a href="https://github.com/williambj1">Bat.bat</a> 大佬提供的：</p>
<p><img alt="" src="https://image.3001.net/images/20211221/16400555425472.png" /> </p>
<ul>
<li><strong>Skylake</strong>（intel 6 代 CPU）</li>
</ul>
<div class="highlight"><pre><span></span><code><span class="n">If</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&gt;</span><span class="w"> </span><span class="mi">47</span><span class="w"> </span><span class="n">And</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&lt;=</span><span class="w"> </span><span class="mi">79</span><span class="w"> </span><span class="n">Then</span><span class="w">     </span>
<span class="w">    </span><span class="n">GPIOPIN</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="mi">24</span><span class="w">   </span>
<span class="w">    </span><span class="n">GPIOPIN2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">72</span><span class="w">  </span>
<span class="n">ElseIf</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&gt;</span><span class="w"> </span><span class="mi">79</span><span class="w"> </span><span class="n">And</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&lt;=</span><span class="w"> </span><span class="mi">119</span><span class="w"> </span><span class="n">Then</span><span class="w"></span>
<span class="w">    </span><span class="n">GPIOPIN</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="mi">24</span><span class="w"></span>
<span class="n">End</span><span class="w"> </span><span class="n">If</span><span class="w"></span>
</code></pre></div>
<ul>
<li><strong>CoffeeLake-H</strong>（intel 8 代标压 CPU）</li>
</ul>
<div class="highlight"><pre><span></span><code><span class="n">If</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&gt;</span><span class="w"> </span><span class="mi">47</span><span class="w"> </span><span class="n">And</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&lt;=</span><span class="w"> </span><span class="mi">71</span><span class="w"> </span><span class="n">Then</span><span class="w">   </span>
<span class="w">    </span><span class="n">GPIOPIN</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="mi">16</span><span class="w">   </span>
<span class="w">    </span><span class="n">GPIOPIN2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">240</span><span class="w"> </span>
<span class="w">    </span><span class="n">If</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&gt;</span><span class="w"> </span><span class="mi">47</span><span class="w"> </span><span class="n">And</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&lt;=</span><span class="w"> </span><span class="mi">59</span><span class="w"> </span><span class="n">Then</span><span class="w"> </span><span class="n">GPIOPIN3</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">304</span><span class="w">  </span>
<span class="n">ElseIf</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&gt;</span><span class="w"> </span><span class="mi">71</span><span class="w"> </span><span class="n">And</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&lt;=</span><span class="w"> </span><span class="mi">95</span><span class="w"> </span><span class="n">Then</span><span class="w"> </span>
<span class="w">    </span><span class="n">GPIOPIN</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="mi">8</span><span class="w">    </span>
<span class="w">    </span><span class="n">GPIOPIN3</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">152</span><span class="w"></span>
<span class="w">    </span><span class="n">GPIOPIN2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">120</span><span class="w"> </span>
<span class="n">ElseIf</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&gt;</span><span class="w"> </span><span class="mi">95</span><span class="w"> </span><span class="n">And</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&lt;=</span><span class="w"> </span><span class="mi">119</span><span class="w"> </span><span class="n">Then</span><span class="w"> </span>
<span class="w">    </span><span class="n">GPIOPIN</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">APICPIN</span><span class="w">        </span>
<span class="n">If</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&gt;</span><span class="w"> </span><span class="mi">108</span><span class="w"> </span><span class="n">And</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&lt;=</span><span class="w"> </span><span class="mi">115</span><span class="w"> </span><span class="n">Then</span><span class="w"> </span>
<span class="w">    </span><span class="n">GPIOPIN2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">20</span><span class="w"> </span>
<span class="n">End</span><span class="w"> </span><span class="n">If</span><span class="w"></span>
</code></pre></div>
<ul>
<li><strong>CoffeeLake-LF 和 Whiskylake</strong>（intel 8 代低压 CPU 和 Whiskylake 架构 CPU）</li>
</ul>
<div class="highlight"><pre><span></span><code><span class="n">If</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&gt;</span><span class="w"> </span><span class="mi">47</span><span class="w"> </span><span class="n">And</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&lt;=</span><span class="w"> </span><span class="mi">71</span><span class="w"> </span><span class="n">Then</span><span class="w">      </span>
<span class="w">    </span><span class="n">GPIOPIN</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="mi">16</span><span class="w">   </span>
<span class="w">    </span><span class="n">GPIOPIN2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">80</span><span class="w">  </span>
<span class="n">ElseIf</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&gt;</span><span class="w"> </span><span class="mi">71</span><span class="w"> </span><span class="n">And</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&lt;=</span><span class="w"> </span><span class="mi">95</span><span class="w"> </span><span class="n">Then</span><span class="w">  </span>
<span class="w">    </span><span class="n">GPIOPIN2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">184</span><span class="w"> </span>
<span class="w">    </span><span class="n">GPIOPIN</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">88</span><span class="w">   </span>
<span class="n">ElseIf</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&gt;</span><span class="w"> </span><span class="mi">95</span><span class="w"> </span><span class="n">And</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&lt;=</span><span class="w"> </span><span class="mi">119</span><span class="w"> </span><span class="n">Then</span><span class="w"> </span>
<span class="w">    </span><span class="n">GPIOPIN</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">APICPIN</span><span class="w">        </span>
<span class="n">ElseIf</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&gt;</span><span class="w"> </span><span class="mi">108</span><span class="w"> </span><span class="n">And</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&lt;=</span><span class="w"> </span><span class="mi">115</span><span class="w"> </span><span class="n">Then</span><span class="w"> </span>
<span class="w">    </span><span class="n">GPIOPIN2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="mi">44</span><span class="w"> </span>
<span class="n">End</span><span class="w"> </span><span class="n">If</span><span class="w"></span>
</code></pre></div>
<p>我的笔记本 CPU 是 <code>i7-10510U</code>，属于 Comet Lake 的低压 CPU，会发现上述公式并没有 Comet Lake 系列的，不过 <a href="https://github.com/williambj1">Bat.bat</a> 大佬说 10 代就是 8 代的马甲，所以使用 CoffeeLake-LF 和 Whiskylake 公式即可，带入公式可计算出我们的 GPIO Pin 的十进制：</p>
<p>我们的 APICPIN 的 16进制为 6d，转换为 10 进制为 109，满足公式如下条件：</p>
<div class="highlight"><pre><span></span><code><span class="n">ElseIf</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&gt;</span><span class="w"> </span><span class="mi">95</span><span class="w"> </span><span class="n">And</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&lt;=</span><span class="w"> </span><span class="mi">119</span><span class="w"> </span><span class="n">Then</span><span class="w"> </span>
<span class="w">    </span><span class="n">GPIOPIN</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">APICPIN</span><span class="w">    </span><span class="c1">// GPIOPIN = 109</span>
</code></pre></div>
<p>即 GPIOPIN = 109，转换为 16 进制就是 <code>6d</code></p>
<p>同时会发现我们的 APICPIN 也满足如下条件：</p>
<div class="highlight"><pre><span></span><code><span class="n">ElseIf</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&gt;</span><span class="w"> </span><span class="mi">108</span><span class="w"> </span><span class="n">And</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">&lt;=</span><span class="w"> </span><span class="mi">115</span><span class="w"> </span><span class="n">Then</span><span class="w"> </span>
<span class="w">    </span><span class="n">GPIOPIN2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">APICPIN</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="mi">44</span><span class="w">  </span><span class="c1">// GPIOPIN2 = 109 - 44 = 65</span>
</code></pre></div>
<p>即GPIOPIN = 65，转换为 16 进制就是 <code>41</code></p>
<p>可以看到我们算出了 2 个值，分别是 <code>6d</code>和<code>41</code>，得一个个尝试去验证就可以了。</p>
<blockquote>
<p>在极少数情况下，计算出来的 GPIO Pin 值不起作用。在这种情况下，你可以尝试一些常见的值：<code>0x17</code>，<code>0x1B</code>，<code>0x34</code>和<code>0x55</code>。</p>
</blockquote>
<p>最终国光尝试了我的这个 GDX1515 触控板的 GPIO Pin 值为 <code>6d</code>：</p>
<p><img alt="" src="https://image.3001.net/images/20211221/16400562947066.png" /> </p>
<p>放一个贴图，这样大家看起来应该会比较直观一点。</p>
<h2 id="_7">最终效果<a class="headerlink" href="#_7" title="Permanent link">&para;</a></h2>
<p>使用<a href="https://github.com/vulgo/IORegistryExplorer">IORegistryExplorer</a> 可以看到我们的这个 GDX1515 冷门小众的触控板终于工作在 GPIO 中断模式下了，可以看到出现了 <code>gpioPin</code> 和 <code>gpioIRQ</code> 属性值，完美：</p>
<p><img alt="img" src="https://image.3001.net/images/20211221/1640056552178.png" /></p>
<p>再来看下 dmesg 的日志情况：</p>
<div class="highlight"><pre><span></span><code><span class="c1"># 发现了 GDX1515 的 I2C 协议的触控板</span><span class="w"></span>
<span class="na">[   44.313108]: VoodooI2CControllerDriver::pci8086,2e9 Found I2C device: GDX1515</span><span class="w"></span>

<span class="c1"># ETPD 发现了有效的 _CRS 方法</span><span class="w"></span>
<span class="na">[   44.313178]: VoodooI2CDeviceNub::ETPD Found valid resources from _CRS method</span><span class="w"></span>
<span class="na">[   44.313182]: VoodooI2CControllerDriver::pci8086,2e8 Got bus configuration values</span><span class="w"></span>
<span class="na">[   44.313231]: VoodooI2CDeviceNub::ETPD Returned index 0x0 from _DSM or XDSM method is not supported</span><span class="w"></span>
<span class="na">[   44.313235]: VoodooI2CDeviceNub::ETPD Could not retrieve resources from _DSM or XDSM method</span><span class="w"></span>

<span class="c1"># ETPD 发现了有效的 GPIO 中断</span><span class="w"></span>
<span class="na">[   44.313244]: VoodooI2CDeviceNub::ETPD Found valid GPIO interrupts</span><span class="w"></span>
<span class="na">[   44.313344]: VoodooI2CControllerDriver::pci8086,2e8 Publishing device nubs</span><span class="w"></span>

<span class="c1"># ETPD 得到 GPIO 控制器</span><span class="w"></span>
<span class="na">[   44.313347]: VoodooI2CDeviceNub::ETPD Got GPIO Controller! VoodooGPIOCannonLakeLP</span><span class="w"></span>
<span class="na">[   44.816012]: VoodooI2CHIDDevice:0x100000738 start</span><span class="w"></span>

<span class="c1"># GDX1515 设备启动的重置完成</span><span class="w"></span>
<span class="na">[   44.919729]: VoodooI2CHIDDevice::GDX1515 Device initiated reset accomplished</span><span class="w"></span>
<span class="na">[   45.050029]: VoodooI2CHIDDevice:0x100000738 creating interfaces</span><span class="w"></span>
<span class="na">[   45.051068]: VoodooI2CHIDDevice:0x100000738 Matching has vendor DeviceUsagePage : ff0c bundleIdentifier com.apple.AppleUserHIDDrivers ioclass AppleUserHIDEventService but transport and vendorID is missing</span><span class="w"></span>
<span class="na">[   45.053582]: VoodooI2CPrecisionTouchpadHIDEventDriver:0x10000073d start</span><span class="w"></span>
<span class="na">[   45.059693]: open by VoodooI2CPrecisionTouchpadHIDEventDriver 0x10000073d (0x0)</span><span class="w"></span>

<span class="c1"># GDX1515 进入  Precision Touchpad Mode (PTP)模式，即高精度触控板模式</span><span class="w"></span>
<span class="na">[   45.059739]: VoodooI2CPrecisionTouchpadHIDEventDriver::GDX1515 Putting device into Precision Touchpad Mode</span><span class="w"></span>
</code></pre></div>
<p>从日志中也可以看到完美工作了，工作在 GPIO 中断模式下。</p>
<p>为了有对比，下面再附上没有工作在 GPIO 中断模式下的日志情况：</p>
<ul>
<li><strong>没有定制 DSDT 在轮询下的日志</strong></li>
</ul>
<div class="highlight"><pre><span></span><code><span class="na">[   48.517816]: VoodooI2CControllerDriver::pci8086,2e9 Found I2C device: GDX1515</span><span class="w"></span>
<span class="na">[   48.517869]: VoodooI2CDeviceNub::ETPD Found valid resources from _CRS method</span><span class="w"></span>
<span class="na">[   48.517913]: VoodooI2CDeviceNub::ETPD Returned index 0x0 from _DSM or XDSM method is not supported</span><span class="w"></span>
<span class="na">[   48.517917]: VoodooI2CDeviceNub::ETPD Could not retrieve resources from _DSM or XDSM method</span><span class="w"></span>

<span class="c1"># ETPD 警告，发现了不兼容的 APIC pin 值 6d，它是大于 2f 的</span><span class="w"></span>
<span class="na">[   48.517925]: VoodooI2CDeviceNub::ETPD Warning: Incompatible APIC interrupt pin (0x6d &gt; 0x2f)</span><span class="w"></span>

<span class="c1"># ETPD 找不到任何 APIC 或 GPIO 中断。 您可能将在轮询模式下运行。</span><span class="w"></span>
<span class="na">[   48.517931]: VoodooI2CDeviceNub::ETPD Warning: Could not find any APIC nor GPIO interrupts. Your chosen satellite will run in polling mode if implemented.</span><span class="w"></span>
<span class="na">[   48.519529]: VoodooI2CHIDDevice:0x100000725 start</span><span class="w"></span>

<span class="c1"># GDX1515 无法获取中断事件源，改用轮询模式</span><span class="w"></span>
<span class="na">[   48.519539]: VoodooI2CHIDDevice::GDX1515 Warning: Could not get interrupt event source, using polling instead</span><span class="w"></span>
<span class="na">[   48.722472]: VoodooI2CHIDDevice::GDX1515 Device initiated reset accomplished</span><span class="w"></span>
<span class="na">[   48.854707]: VoodooI2CHIDDevice:0x100000725 creating interfaces</span><span class="w"></span>
<span class="na">[   48.856351]: VoodooI2CHIDDevice:0x100000725 Matching has vendor DeviceUsagePage : ff0c bundleIdentifier com.apple.AppleUserHIDDrivers ioclass AppleUserHIDEventService but transport and vendorID is missing</span><span class="w"></span>
<span class="na">[   48.860549]: VoodooI2CPrecisionTouchpadHIDEventDriver:0x10000072a start</span><span class="w"></span>
<span class="na">[   48.866671]: open by VoodooI2CPrecisionTouchpadHIDEventDriver 0x10000072a (0x0)</span><span class="w"></span>

<span class="c1"># GDX1515 进入  Precision Touchpad Mode (PTP)模式，即高精度触控板模式</span><span class="w"></span>
<span class="na">[   48.866716]: VoodooI2CPrecisionTouchpadHIDEventDriver::GDX1515 Putting device into Precision Touchpad Mode</span><span class="w"></span>
</code></pre></div>
<ul>
<li><strong>定制了 DSDT，但 GPIO 不正确的日志</strong></li>
</ul>
<div class="highlight"><pre><span></span><code><span class="na">[   37.835221]: VoodooI2CControllerDriver::pci8086,2e9 Found I2C device: GDX1515</span><span class="w"></span>
<span class="na">[   37.835266]: VoodooI2CDeviceNub::ETPD Found valid resources from _CRS method</span><span class="w"></span>
<span class="na">[   37.835298]: VoodooI2CDeviceNub::ETPD Returned index 0x0 from _DSM or XDSM method is not supported</span><span class="w"></span>
<span class="na">[   37.835306]: VoodooI2CDeviceNub::ETPD Could not retrieve resources from _DSM or XDSM method</span><span class="w"></span>
<span class="na">[   37.835309]: KextLog: AuxKC bundle com.alexandred.VoodooI2CServices marked as loadable</span><span class="w"></span>

<span class="c1"># ETPD 发现了有效的 GPIO 中断</span><span class="w"></span>
<span class="na">[   37.835312]: VoodooI2CDeviceNub::ETPD Found valid GPIO interrupts</span><span class="w"></span>
<span class="na">[   37.835408]: VoodooI2CDeviceNub::ETPD Got GPIO Controller! VoodooGPIOCannonLakeLP</span><span class="w"></span>
<span class="na">[   38.337232]: VoodooI2CHIDDevice:0x100000761 start</span><span class="w"></span>

<span class="c1"># 无法获取 GPIO 引脚的硬件引脚 81（错误的 GPIO Pin 的10进制），无法获取中断事件源，改用轮询</span><span class="w"></span>
<span class="na">[   38.337263]: VoodooGPIOCannonLakeLP::Failed getting hardware pin for GPIO pin 81VoodooI2CHIDDevice::GDX1515 Warning: Could not get interrupt event source, using polling instead</span><span class="w"></span>
<span class="na">[   38.539715]: VoodooI2CHIDDevice::GDX1515 Device initiated reset accomplished</span><span class="w"></span>
<span class="na">[   38.670485]: VoodooI2CHIDDevice:0x100000761 creating interfaces</span><span class="w"></span>
<span class="na">[   38.672136]: VoodooI2CHIDDevice:0x100000761 Matching has vendor DeviceUsagePage : ff0c bundleIdentifier com.apple.AppleUserHIDDrivers ioclass AppleUserHIDEventService but transport and vendorID is missing</span><span class="w"></span>
<span class="na">[   38.676469]: VoodooI2CPrecisionTouchpadHIDEventDriver:0x100000766 start</span><span class="w"></span>
<span class="na">[   38.682612]: open by VoodooI2CPrecisionTouchpadHIDEventDriver 0x100000766 (0x0)</span><span class="w"></span>

<span class="c1"># GDX1515 进入  Precision Touchpad Mode (PTP)模式，即高精度触控板模式</span><span class="w"></span>
<span class="na">[   38.682668]: VoodooI2CPrecisionTouchpadHIDEventDriver::GDX1515 Putting device into Precision Touchpad Mode</span><span class="w"></span>
</code></pre></div>
<h2 id="_8">炫耀一下<a class="headerlink" href="#_8" title="Permanent link">&para;</a></h2>
<p>双屏笔记本真的很帅，等我最近做一期视频记录一下，到时候也又可以去 B 站水了：</p>
<p><img alt="" src="https://image.3001.net/images/20211221/16400574149088.jpeg" /> </p>
<p>另外有对这个设备感兴趣的朋友，也欢迎进群艾特我哦，做完视频就准备出掉了，价格不贵，16+512GB MX250 双屏只要 4-4.5k元，可小刀很香哦。 </p>
<h2 id="_9">支持一下？<a class="headerlink" href="#_9" title="Permanent link">&para;</a></h2>
<p>在这个喧嚣浮躁的时代，坚持写博客输出原创文章的人还有多少呢？写博客感觉一直是用爱发电的状态......</p>
<p>如果你恰巧财力雄厚，感觉本文对你有所帮助的话，可以考虑打赏一下本文，用以维持高昂的服务器运营费用（域名费用、服务器费用、CDN 费用等）</p>
<table>
    <tr>
        <td>微信
            <center><img src="https://image.3001.net/images/20200421/1587449920128.jpg " width="70%"></center>
        </td>
        <td width="50%">
          支付宝
            <center><img src="https://image.3001.net/images/20200421/15874503376388.jpg" width="70%"></center>
        </td>
    </tr>
</table>

<p>国光我也写了一个打赏页面用以感谢支持我的朋友，详情请看 <a href="https://www.sqlsec.com/reward/">打赏列表 | 国光</a></p>

  <hr>
<div class="md-source-file">
  <small>
    
      最后更新:
      2022-09-19
    
  </small>
</div>





                
              </article>
            </div>
          
          
        </div>
        
      </main>
      
        <footer class="md-footer">
  
    
    <nav class="md-footer__inner md-grid" aria-label="页脚" >
      
        
        <a href="../6-2/" class="md-footer__link md-footer__link--prev" aria-label="上一页: 编译触控板驱动" rel="prev">
          <div class="md-footer__button md-icon">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
          </div>
          <div class="md-footer__title">
            <div class="md-ellipsis">
              <span class="md-footer__direction">
                上一页
              </span>
              编译触控板驱动
            </div>
          </div>
        </a>
      
      
        
        <a href="../6-4/" class="md-footer__link md-footer__link--next" aria-label="下一页: 台式机双显卡显示" rel="next">
          <div class="md-footer__title">
            <div class="md-ellipsis">
              <span class="md-footer__direction">
                下一页
              </span>
              台式机双显卡显示
            </div>
          </div>
          <div class="md-footer__button md-icon">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4Z"/></svg>
          </div>
        </a>
      
    </nav>
  
  <div class="md-footer-meta md-typeset">
    <div class="md-footer-meta__inner md-grid">
      <div class="md-copyright">
  
    <div class="md-copyright__highlight">
      Copyright &copy; 2021 - 2022 国光
    </div>
  
  
</div>
      
        <div class="md-social">
  
    
    
    <a href="https://www.sqlsec.com" target="_blank" rel="noopener" title="国光" class="md-social__link">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M341.52 285.56c33.65 0 82.34-6.94 82.34-47 .22-6.74.86-1.82-20.88-96.24-4.62-19.15-8.68-27.84-42.31-44.65-26.09-13.34-82.92-35.37-99.73-35.37-15.66 0-20.2 20.17-38.87 20.17-18 0-31.31-15.06-48.12-15.06-16.14 0-26.66 11-34.78 33.62-27.5 77.55-26.28 74.27-26.12 78.27 0 24.8 97.64 106.11 228.47 106.11M429 254.84c4.65 22 4.65 24.35 4.65 27.25 0 37.66-42.33 58.56-98 58.56-125.74.08-235.91-73.65-235.91-122.33a49.55 49.55 0 0 1 4.06-19.72C58.56 200.86 0 208.93 0 260.63c0 84.67 200.63 189 359.49 189 121.79 0 152.51-55.08 152.51-98.58 0-34.21-29.59-73.05-82.93-96.24"/></svg>
    </a>
  
</div>
      
    </div>
  </div>
</footer>
      
    </div>
    <div class="md-dialog" data-md-component="dialog">
      <div class="md-dialog__inner md-typeset"></div>
    </div>
    
    <script id="__config" type="application/json">{"base": "../..", "features": ["navigation.tabs", "navigation.tabs.sticky", "search.suggest", "search.highlight", "search.share"], "search": "../../assets/javascripts/workers/search.ecf98df9.min.js", "translations": {"clipboard.copied": "\u5df2\u590d\u5236", "clipboard.copy": "\u590d\u5236", "search.config.lang": "ja", "search.config.pipeline": "trimmer, stemmer", "search.config.separator": "[\\s\\-\uff0c\u3002]+", "search.placeholder": "\u641c\u7d22", "search.result.more.one": "\u5728\u8be5\u9875\u4e0a\u8fd8\u6709 1 \u4e2a\u7b26\u5408\u6761\u4ef6\u7684\u7ed3\u679c", "search.result.more.other": "\u5728\u8be5\u9875\u4e0a\u8fd8\u6709 # \u4e2a\u7b26\u5408\u6761\u4ef6\u7684\u7ed3\u679c", "search.result.none": "\u6ca1\u6709\u627e\u5230\u7b26\u5408\u6761\u4ef6\u7684\u7ed3\u679c", "search.result.one": "\u627e\u5230 1 \u4e2a\u7b26\u5408\u6761\u4ef6\u7684\u7ed3\u679c", "search.result.other": "# \u4e2a\u7b26\u5408\u6761\u4ef6\u7684\u7ed3\u679c", "search.result.placeholder": "\u952e\u5165\u4ee5\u5f00\u59cb\u641c\u7d22", "search.result.term.missing": "\u7f3a\u5c11", "select.version.title": "\u9009\u62e9\u5f53\u524d\u7248\u672c"}}</script>
    
    
      <script src="../../assets/javascripts/bundle.d691e9de.min.js"></script>
      <script id="click-show-text" src="https://html.sqlsec.com/click-show-text.min.js" data-mobile="false" data-text="OpenCore,Hackintosh,DSDT,SSDT,Kernel,Kexts,UEFI,NVRAM,BIOS,ACPI,Clover,AWAC,XOSI,Lilu.kext,VirtualSMC.kext,WhateverGreen.kext" data-fontsize="15px" data-random="false" async="async"></script>
      
    
  </body>
</html>